﻿using System;
using Microsoft.Xna.Framework;

namespace ThreeDContentPipeline
{
    public static class ParserHelper
    {
        public static Vector2 ParseVector2(string text)
        {
            string[] tokens = text.Split(new char[] { ' ', '\t', '\r', '\n', ',' }, StringSplitOptions.RemoveEmptyEntries);

            return new Vector2(float.Parse(tokens[0]), float.Parse(tokens[1]));
        }

        public static Vector3 ParseVector3(string text)
        {
            string[] tokens = text.Split(new char[] { ' ', '\t', '\r', '\n', ',' }, StringSplitOptions.RemoveEmptyEntries);

            return new Vector3(float.Parse(tokens[0]), float.Parse(tokens[1]), float.Parse(tokens[2]));
        }

        public static Vector4 ParseVector4(string text)
        {
            string[] tokens = text.Split(new char[] { ' ', '\t', '\r', '\n', ',' }, StringSplitOptions.RemoveEmptyEntries);

            return new Vector4(float.Parse(tokens[0]), float.Parse(tokens[1]), float.Parse(tokens[2]), float.Parse(tokens[3]));
        }
    }
}
